    var dataJson;

    /**
    *@Author cirly
    *@Description 初始页面调取商品信息并显示
    *@Date 12:24 2018/11/5
    *@Modify by
    *@Version 1.0
    */
   /* window.onload=function (){
       // var productQR = "test123";
        var data = "";
        //alert(data);
        // var xmlhttp = null;
        var url = "productInfo!productList";
        sendRequest("post", url, data, getProductBack);
    };*/



    function classifyProduct (type) {
        //console.log(type);
        var classfyJson = [];
        for (var i= 0;i<dataJson.length;i++){
            if(dataJson[i].productType == type) classfyJson.push(dataJson[i]);
        }
        if(classfyJson.length <= 0){
            alert("对不起，此类商品尚未上架！");
        }else{
            indexData(classfyJson);
        }

    }
    function transfer(a) {
        var productQR = a.id;
        if(productQR != null){
            var data = "productQR=" + productQR;
            //var proCode = encodeURI(data);

            window.location.href = "item.html?" + data;
        }
        //alert(productQR);
        //此法行不通
        /*if(productQR != null) {
            //sessionStorage.setItem("productQR", productQR);
            var url = "productInfo!getById";
            var data = "productQR=" + productQR;
            sendRequest("post",url,data,showItem);
            //window.location.href = "item.html";
        }else{
            alert("商品信息获取失败，请稍后再试！");
        }*/
    }

    function productClassfy(data , type ){
        var returnData ={};
        for(var i = 0; i<data.length; i++){
            if(data[i].productType == type) returnData.push(data[i]);
        }
        return returnData;
    }

    window.onload=function (){
        var counter = 0;
        // 每页展示4个

        var currentPage=1;
        var rows=4;

        // dropload
        $('.content').dropload({
            scrollArea : window,
            domDown : {
                domClass   : 'dropload-down',
                domRefresh : '<div class="dropload-refresh">↑上拉加载更多</div>',
                domLoad    : '<div class="dropload-load"><span class="loading"></span>加载中</div>',
                domNoData  : '<div class="dropload-noData">暂无数据</div>'
            },
            loadDownFn : function(me){
                var str="";
                $.ajax({
                    type: 'post',
                    url: '/productInfo!showByPage1',
                    data: {'currentPage': currentPage,"rows":rows},
                    async: true,
                    success: function(dataJson){
                        dataJson = eval("("+ dataJson +")");
                        console.log(dataJson);
                        currentPage++;
                        counter++;
                        if(dataJson.list.length > 0){
                            for(var j = 0; j<dataJson.list.length; j++) {

                                //var imgAddr = [] ;
                                // imgAddr = dataJson[i].proproductPhotoFileAddr.splitText(",");
                                //var str="";
                                /*str+=' <a href="javascript:void(0)" id=\"' + dataJson[i].productQR + '\" onclick="transfer(this)" class="aui-ware-grid-item" xmlns="http://www.w3.org/1999/html"><div class="aui-ware-grid-img"> <img src='
                                    data:image/jpg;base64,'+ dataJson[i].proproductPhotoFileAddr+' alt=""></div><div class="aui-ware-grid-mes"><h3>'
                                    +dataJson[i].productName+'</h3> <br class="aui-ware-grid-mes-item"><div class="aui-ware-grid-price"><span><i>￥</i>'
                                    +dataJson[i].salePrice+'</span>\n'
                                    +'</div></br>' +'<div class="aui-ware-grid-time">2010年-9.7万公里</div></br>'
                                    +'</div></br>' + '</div></br>' +'</a>';*/
                                str += "<a href=\"javascript:void(0)\" id=  " + dataJson.list[j].productQR + "  onclick=\"transfer(this)\" class=\"aui-ware-grid-item\" xmlns=\"http://www.w3.org/1999/html\">\n" +
                                    "    <div class=\"aui-ware-grid-img\"> \n" +
                                    "    <img src=\"data:image/jpg;base64," + dataJson.list[j].productPhoto + "\" alt=\"\">\n" +
                                    "    </div>\n" +
                                    "    <div class=\"aui-ware-grid-mes\">\n" +
                                    "    <h3>" + dataJson.list[j].productName + "</h3> \n" +
                                    "    <br class=\"aui-ware-grid-mes-item\">\n" +
                                    "    <div class=\"aui-ware-grid-price\">\n" +
                                    "    <span><i>售价：￥" + dataJson.list[j].salePrice + "</i></span>" +
                                    "</br><span><i>租价：￥" + dataJson.list[j].rentPrice + " /天</i>" +
                                    "    </span>\n" +
                                    "    </div></br>\n" +
                                    "    <div class=\"aui-ware-grid-time\">" + dataJson.list[j].introduction + "</div>\n" +
                                    "    </br>\n" +
                                    "            </div>\n" +
                                    "            </div>\n" +
                                    "    \t</a>";
                            }
                        }else{
                                // 锁定
                                me.lock();
                                // 无数据
                                me.noData();
                        }
                        setTimeout(function(){
                            $('.lists').append(str);

                            // 每次数据加载完，必须重置
                            me.resetload();
                        });
                    },
                    error: function(xhr, type){
                        alert('服务器正忙。。。');
                        // 即使加载出错，也得重置
                        me.resetload();
                    }
                });
            },
            threshold : 50
        });
    };

